package com.stock.core.persistence.writer.stock;

import com.stock.api.domain.stock.BusinessHistoryBean;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;

public interface BusinessHistoryWriterMapper {
    /**
     *  根据主键删除数据库的记录,business_history
     *
     * @param id
     */
    int deleteByPrimaryKey(Long id);

    /**
     *  新写入数据库记录,business_history
     *
     * @param record
     */
    int insert(BusinessHistoryBean record);

    /**
     *  动态字段,写入数据库记录,business_history
     *
     * @param record
     */
    int insertSelective(BusinessHistoryBean record);

    /**
     *  根据指定主键获取一条数据库记录,business_history
     *
     * @param id
     */
    BusinessHistoryBean selectByPrimaryKey(Long id);

    /**
     *  动态字段,根据主键来更新符合条件的数据库记录,business_history
     *
     * @param record
     */
    int updateByPrimaryKeySelective(BusinessHistoryBean record);

    /**
     *  根据主键来更新符合条件的数据库记录,business_history
     *
     * @param record
     */
    int updateByPrimaryKey(BusinessHistoryBean record);

    /**
     * 更新卖出ID
     *
     * @param id
     * @param outId
     * @param profitLoss
     * @return
     */
    int updateOutIdById(@Param("id") Long id, @Param("outId") Long outId, @Param("profitLoss") BigDecimal profitLoss);

    /**
     * 根据主键更新买入标志
     *
     * @param id
     * @return
     */
    int updateIsBuyById(Long id);
}